struct Camera {
    pos: vec2f,
    scale: vec2f,
}
@group(0) @binding(0)
var<uniform> camera: Camera;

var<private> vertices: array<vec2f, 4> = array(
    vec2f(-1.0, -1.0),
    vec2f(1.0, -1.0),
    vec2f(-1.0, 1.0),
    vec2f(1.0, 1.0),
);

struct VertexOutput {
    @builtin(position) clip_pos: vec4f,
    @location(0) texel_pos: vec2f,
}

override R: f32 = 0.02;
@vertex
fn vs_main(
    @builtin(vertex_index) vid: u32,
    @location(0) pos: vec2f
) -> VertexOutput {
    var out : VertexOutput;
    out.texel_pos = vertices[vid];
    out.clip_pos = vec4f((pos + out.texel_pos * R - camera.pos) * camera.scale, 0.0, 1.0);
    return out;
}

@fragment
fn fs_main(
    in: VertexOutput
) -> @location(0) vec4f {
    if length(in.texel_pos) < 1.0 {
        return vec4f(0.7, 0.7, 0.7, 0.5);
    } else {
        discard;
    }
}